#include <Arduino.h>
#include "ESP8266WiFi.h"
#include "WiFiManager.h"    //安装第三方库tzapu/WiFiManager

void setup() {
    Serial.begin(9600);
    //EspClass::eraseConfig(); //可清除历史wifi配置

    WiFiManager wm;
    wm.autoConnect("ESP8266-WIFI","12345678");  //设置esp8266的wifi名和密码，密码必须8位

    while(WiFi.status()!=WL_CONNECTED){    //检查wifi状态是否连接上
        delay(100);
        Serial.println("retry connect wifi....");
    }
    Serial.print("IP:");         //连接上了，就打印IP
    Serial.println(WiFi.localIP());
}

void loop() {

}